home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-05-01 | 1.2 KB | 56 lines | [TEXT/MPS ] |
- /************************************************************
-
- Created: Tuesday, November 6, 1991
- TestAFP.cp
- Testing and sample code for the AFP C++ library code
-
- Copyright Apple Computer, Inc. 1985-1991
- All rights reserved
-
- ************************************************************/
- #include "TestSession.h"
- #include "stream.h"
-
- const Byte kShortName = 1;
- const Byte kLongName = 2;
- const Byte kSoftCreate = 0x00;
- const Byte kHardCreate = 0x80;
- const long kRootDirID = 2;
- const Byte kRsrcFork = 0x80;
- const Byte kDataFork = 0x00;
-
- int main() {
-
- TestSession * client;
- short ForkID;
- short VolID;
- long DirID;
-
- client = new TestSession;
-
- client->SetPrint( true );
-
- client->ISession( "*", "Milkyway" );
-
- client->LoginCleartxt( "Utopia", "paradise" );
-
- client->OpenVol( "Orion", "", 0x20 );
-
- VolID = client->GetVolumeID();
-
- client->CreateDir( VolID, 2, kLongName, "NewDirectory" );
-
- DirID = client->GetDirID();
-
- client->CreateFile( VolID, DirID, kHardCreate, kLongName, "NewFile" );
-
- client->OpenFork( kDataFork, VolID, DirID, 0, 0x03, kLongName, "NewFile" );
-
- ForkID = client->GetForkID();
-
- client->Write( ForkID, 0,11, 0, "Hello World" );
-
- client->Logout();
- delete client;
- return 0;
- }